<include file="public/min-header"/>
<div class="wrapper">
    <include file="public/breadcrumb"/>
    <style>#search-form > .form-group{margin-left: 10px;}</style>
    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 抵扣券二维码列表</h3>
                </div>
                <div class="panel-body">
                    <div class="navbar navbar-default">

                        <form action="javascript:;" id="search-form" class="navbar-form form-inline" method="post" onsubmit="return false">
                            <div class="form-group">
                                <input type="text" name="keywords" class="form-control" placeholder="搜索：抵扣券名称">
                            </div>
                            <div class="form-group">
                                <select name="type" class="form-control">
                                    <option value="0">未使用</option>
                                    <option value="1">已使用</option>
                                </select>
                            </div>

                            <button type="submit" onclick="ajax_get_table('search-form', 1)" id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>
                            <button type="button" onclick="layerAlert('添加', '{:U('voucherqrcode/add')}', '70%', '85%')" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加</button>
                        </form>
                    </div>
                    <div id="ajax_return"> </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
    $(document).ready(function(){
        // ajax 加载商品列表
        ajax_get_table('search-form', 1);

    });
    cur_page = 1;
    // ajax 抓取页面 form 为表单id  page 为当前第几页
    function ajax_get_table(form, page){
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type : "POST",
            url:"/index.php?m=mingteng&c=voucherqrcode&a=ajax_index&page="+page,//+tab,
            data : $('#'+form).serialize(),// 你的formid
            success: function(data){
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    }

</script>
</body>
</html>